
#ifndef Velyn_Camera_h
#define Velyn_Camera_h

#include <math.h>

namespace Velyn {

    /*
     * Camera class that handles all of the cameras in the scene.
     */
    class Camera {

    private:
        
        float x, y, z, angle;
        
        float distance;
        
        // x
        float pitch(float speed) {
            return speed * sin(angle);
        }
        
        // y
        float roll(float speed) {
            return speed * cos(angle);
        }
        
        // z
        float yaw(float speed) {
            return speed * cos(angle);
        }
        
    public:
        
        Camera() {
            distance = 3.0f;
        }
        
        Camera(float distance) {
            this->distance = distance;
        }
        
        ~Camera() {}
        
        void animate() {
            
            angle += 0.01;
            
            if(angle > 360) {
                angle = 0.0;
            }
        }
        
        void setDistance(float distance) {
            this->distance = distance;
        }
        
        /**
         * Enables the camera.
         */
        
        void enable() {
            glMatrixMode(GL_MODELVIEW);
            glLoadIdentity();
            gluLookAt(pitch(distance), 0.0f, yaw(distance), 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
        }
    };
}

#endif
